package com.cro.prison.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.cro.prison.dao.DeviceDao;
import com.cro.prison.entity.pojo.Device;
import com.cro.prison.service.DeviceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class DeviceServiceimpl extends ServiceImpl<DeviceDao,Device> implements DeviceService {

    @Autowired
    DeviceDao deviceDao;

    @Override
    public Device selectById(Long id) {
        Device device = deviceDao.selectById(id);
        return device;
    }

    @Override
    public List<Device> selectAll() {
        QueryWrapper<Device> query = new QueryWrapper<>();
        query.eq("is_valid",1);
        List<Device> list = deviceDao.selectList(query);
        return list;
    }
}
